﻿CREATE TABLE [dbo].[DayTypeDetails] (
    [DayTypeName]         NVARCHAR (100) NOT NULL,
    [InstitutionEntityID] INT            NOT NULL,
    [MeetingPeriodName]   NVARCHAR (100) NOT NULL,
    [StartTime]           TIME (7)       NOT NULL,
    [EndTime]             TIME (7)       NOT NULL,
    CONSTRAINT [PK_DayTypeDetails] PRIMARY KEY CLUSTERED ([DayTypeName] ASC, [InstitutionEntityID] ASC, [MeetingPeriodName] ASC),
    CONSTRAINT [FK_DayTypeDetails_DayTypes] FOREIGN KEY ([InstitutionEntityID], [DayTypeName]) REFERENCES [dbo].[DayTypes] ([InstitutionEntityID], [DayTypeName]),
    CONSTRAINT [FK_DayTypeDetails_DefinedMeetingPeriods] FOREIGN KEY ([MeetingPeriodName], [InstitutionEntityID]) REFERENCES [dbo].[DefinedMeetingPeriods] ([MeetingPeriodName], [InstitutionEntityID])
);

